//package com.zmn.plat.dubbo.impl.difficultratio;
//
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.manager.common.database.annotation.ReadOnlyConnection;
//import com.zmn.plat.common.dto.difficultratio.DifficultRatioDRO;
//import com.zmn.plat.common.dto.difficultratio.SimpleDifficultRatioDRO;
//import com.zmn.plat.dubbo.interfaces.difficultratio.DifficultRatioListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import com.zmn.plat.model.entity.base.difficult.ratio.DifficultRatio;
//import com.zmn.plat.model.entity.base.difficult.ratio.DifficultRatioQuery;
//import com.zmn.plat.services.interfaces.base.difficult.ratio.DifficultRatioService;
//import com.zmn.plat.utils.bean.BeanCopyUtils;
//import org.apache.dubbo.config.annotation.Service;
//import org.springframework.util.CollectionUtils;
//
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Comparator;
//import java.util.List;
//import java.util.Objects;
//import java.util.stream.Collectors;
//
///**
// * @author tanbiao
// * @description
// * @modifier
// * @since 2021/1/8 18:59
// **/
//@Service(loadbalance = "roundrobin", timeout = 5000, retries = -1, version = DubboConsts.INTERFACE_VERSION, validation = "true")
//public class DifficultRatioListRemoteServiceImpl implements DifficultRatioListRemoteService {
//    @Resource
//    private DifficultRatioService difficultRatioService;
//
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<DifficultRatioDRO> getByDificultId(Integer dificultId) {
//        DifficultRatio ratio = difficultRatioService.findByKey(dificultId);
//        if (Objects.nonNull(ratio)) {
//            DifficultRatioDRO dro = new DifficultRatioDRO();
//            BeanCopyUtils.copyProperties(ratio, dro);
//            return ResponseDTO.success(dro);
//        }
//        return ResponseDTO.success(null, "数据为空");
//    }
//
//    @Override
//    @ReadOnlyConnection
//    public ResponseDTO<List<SimpleDifficultRatioDRO>> listAll(Integer pageNo, Integer pageSize) {
//        List<SimpleDifficultRatioDRO> retList = new ArrayList<>();
//        if (pageSize > 100) {
//            pageSize = 100;
//        }
//        DifficultRatioQuery query = new DifficultRatioQuery();
//        query.setPageSize(pageSize);
//        query.setPageIndex(pageNo);
//        List<DifficultRatio> pageList = difficultRatioService.listPageByQuery(query);
//        if (!CollectionUtils.isEmpty(pageList)) {
//            pageList = pageList.stream().sorted(Comparator.comparing(DifficultRatio::getRatio)).collect(Collectors.toList());
//            retList.addAll(BeanCopyUtils.copyProperties(pageList, DifficultRatio.class, SimpleDifficultRatioDRO.class, SimpleDifficultRatioDRO::new));
//        }
//        return ResponseDTO.success(retList);
//    }
//}
